with Legend.Interactives;
with SDL.Events;
with SDL.Keysym;
with Ada.Containers.Ordered_Sets;
package Legend.Dialogs is

   -- ------- -------------- ----------
   -- |   Prompt           | | ICON   |
   -- |                    | |        |
   -- |                    | |        |
   -- |____________________| |________|
   type Dialog_Type is new Interactives.Interactive_Type with private;

   overriding
   procedure Paint (this : in out Dialog_Type);

   procedure Prompt (
      this : in out Dialog_Type;
      Value : UTF8_String
      );

   function Prompt (
      this : Dialog_Type
      ) return UTF8_String;

   procedure Linefeed (
      this  : in out Dialog_Type;
      Value : UTF8_String
      );

   function Linefeed (
      this : Dialog_Type
      ) return UTF8_String;

   procedure Icon (
      this  : in out Dialog_Type;
      Value : Picture_Type
      );

   procedure Add_Expect (
      this  : in out Dialog_Type;
      Key   : SDL.Keysym.Key_t
      );

   procedure Clear_Expect (this : in out Dialog_Type); 

   overriding
   procedure On_Key_Up (
      this          : in out Dialog_Type;
      Message       : SDL.Events.Keyboard_Event_t;
      Cancel_Bubble : in out Boolean
      );

   function Dialog_Result (this : Dialog_Type) return SDL.Keysym.Key_t;


   overriding
   procedure Initialize (this : in out Dialog_Type);

private
   use type SDL.Keysym.Key_t;
   
   package Keysym_Sets is
      new Ordered_Sets(SDL.Keysym.Key_t);

   type Dialog_Type is new Interactives.Interactive_Type with record
      F_Prompt   : Unbounded_String;
      F_Linefeed : Unbounded_String;
      F_Icon     : Picture_Type;
      F_Expect   : Keysym_Sets.Set;
      F_Result   : SDL.Keysym.Key_t;
   end record;

end Legend.Dialogs;
